package com.wondersgroup.framework.sample.component.form.action;

import com.wondersgroup.framework.core.web.struts2.action.BaseAjaxAction;
import com.wondersgroup.framework.core.web.vo.VOUtils;
import com.wondersgroup.framework.core5.model.vo.ValueObject;
import com.wondersgroup.framework.sample.component.form.vo.CodeInfoVO;
import com.wondersgroup.framework.sample.component.form.vo.TreeSelectVO;

public class TreeSelectAction extends BaseAjaxAction
{
  private TreeSelectVO treeSelectVO;
  private static final String prefix = "{\"success\":true,result:[";
  private static final String suffex = "]}";

  public TreeSelectAction()
  {
    this.treeSelectVO = new TreeSelectVO();
  }

  public ValueObject getValueObject()
  {
    return this.treeSelectVO;
  }

  protected String operate()
  {
    return super.operate();
  }

  public String loadTreeSelect() {
    TreeSelectVO vo = new TreeSelectVO();

    CodeInfoVO city = new CodeInfoVO();
    city.setValue("14,17,15");
    city.setText("九江市,武汉市,湖北省");
    vo.setCity(city);

    CodeInfoVO city2 = new CodeInfoVO();
    city2.setValue("21");
    city2.setText("上海市");
    vo.setCity2(city2);

    String json = "{\"success\":true,result:[" + VOUtils.getJsonData(vo) + "]}";
    createJSonData(json);
    return "ajax";
  }
}